<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $this->title;?></title>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/css/main.css" />
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/jquery.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/load.js"></script>
<!--时间选择器-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/lang/cn_utf8.js"></script>
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-setup.js"></script>
<link rel="stylesheet" href="<?php echo $this->baseUrl;?>/files/admin/js/date/calendar-blue.css" />
<!--colorbox-->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/jquery.colorbox.js"></script>
<!-- member-source-subsource 展开 -->
<script language="javascript" src="<?php echo $this->baseUrl;?>/files/admin/js/dayData/expandClosePutOnAd.js"></script>
<!-- member-source-subsource 展开 -->
<link href="<?php echo $this->baseUrl;?>/files/admin/js/colorbox.jquery/colorbox2.css" rel="stylesheet" type="text/css"/>

</head>

<body style="overflow:auto;">
	<div id="main">
		<div id="topMenu">
			<div id="navigation">当前位置：<?php echo $this->title;?></div>
			<div id="topOtherMenu"></div>
		</div>
		<div id="body">
			<div id="search">
							<form id="searchForm" name="searchForm" method="post" action="<?php echo $this->projectUrl(array('action'=>$this->reportType,'day'=>'between'));?>">
					<table>
						<tr>
							<td >
                            
                            <!-- 时间选择条 -->
                            <div id="timeRange">
                             <a
                            <?php if($this->key=='today'):?>
                             class="currentTimeRange"
                             <?php endif;?>
                             href="<?php echo $this->projectUrl(array('action'=>$this->reportType,'day'=>'today'));?>">今天</a>
                            <a
                            <?php if($this->key=='yestoday'):?>
                             class="currentTimeRange"
                             <?php endif;?>
                             href="<?php echo $this->projectUrl(array('action'=>$this->reportType,'day'=>'yestoday'));?>">昨天</a>
                            
                            <a  <?php if($this->key=='last-seven-day'):?>
                             class="currentTimeRange"
                             <?php endif;?> href="<?php echo $this->projectUrl(array('action'=>$this->reportType,'day'=>'last-seven-day'));?>">最近7天</a>
                            <a  <?php if($this->key=='last-thirty-day'):?>
                             class="currentTimeRange"
                             <?php endif;?>
                             href="<?php echo $this->projectUrl(array('action'=>$this->reportType,'day'=>'last-thirty-day'));?>">最近30天</a>
                            <a  <?php if($this->key=='last-three-month'):?>
                             class="currentTimeRange"
                             <?php endif;?>
                             href="<?php echo $this->projectUrl(array('action'=>$this->reportType,'day'=>'last-three-month'));?>">最近三个月</a>
                            <a
                             <?php if($this->key=='all'):?>
                             class="currentTimeRange"
                             <?php endif;?>
                            href="<?php echo $this->projectUrl(array('action'=>$this->reportType,'day'=>'all'));?>">全部</a>
                            
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <a
                             <?php if($this->key=='between'):?>
                             class="currentTimeRange"
                             <?php endif;?>
                            >日期选择</a>：
                            <input name="startTime" type="text" class="input" id="startTime" size="10" value="<?php echo $this->startTime;?>" />
								<script type="text/javascript">Calendar.setup({"ifFormat":"%Y-%m-%d","firstDay":0,"showsTime":true,"showOthers":false,"timeFormat":24,"inputField":"startTime","button":"startTime"});</script>
-
<input name="endTime" type="text" class="input" id="endTime" size="10" value="<?php echo $this->endTime;?>" />
<script type="text/javascript">Calendar.setup({"ifFormat":"%Y-%m-%d","firstDay":0,"showsTime":true,"showOthers":false,"timeFormat":24,"inputField":"endTime","button":"endTime"});</script>
                            <input name="search" type="submit" id="searchBtn" value="查找" class="button" />
                            <BR />
                           <a name="exportBtn" id="exportBtn" style="background:none; padding-left:0px; padding-top:2px; padding-bottom:2px; text-decoration:none;" >[输出Excel文件]</a>
                            &nbsp;</div>
                            <!-- 时间选择条 -->						  </td>
					  </tr>
					</table>
			  </form>
			</div>

			<div id="content">
			</div>
            
				<form id="listForm" name="listForm" method="post" action="">
					<table class="table reportTable" style="width:auto;" >
						<tr class="subject">
							<td >广告渠道</td>
						  <td>ROI</td>
						  <td >订单金额</td>
							<td >订单量</td>
                        
						  <td >客单价</td>
                          
						  <td >广告成本</td>
					    </tr>
<?php if(count($this->rowsPaid)):?>                        
<?php foreach($this->rowsPaid as $key=>$row) {?>
						<tr class="dataLine data-show-<?php echo ($key%2+1);?>">
							<td>
                            <?php if ($row['name'] != '总计'):?>
                             <span style="cursor:pointer;" class="expandMemberSource" id="expandMemberSource_<?php echo $row['name'];?>" memberName="<?php echo $row['name'];?>" > + </span>
                             <?php endif;?>
							<?php echo $row['name'];?></td>
							<td style="text-align:center;"><?php echo !empty($row['ROI'])
							? '1 : '.round($row['ROI'],3):'--';?></td>
							<td style="text-align:right;"><?php echo !empty($row['okOrderAmount'])?'￥'.number_format($row['okOrderAmount'], 2, '.', ','):'--';?></td>
							<td style="text-align:right;"><?php echo !empty($row['okOrderNum'])? $row['okOrderNum']:'--';?></td>
							<?php if(!isset($this->rowsPaid[0]) || array_key_exists('perPrice', $this->rowsPaid[0])):?>
                            <td style="text-align:right;"><?php echo !empty($row['perPrice']) ? '￥'.number_format($row['perPrice'],2, '.', ',') : '--';?></td>
                            <?php endif;?>
							<td style="text-align:right;"><?php echo !empty($row['adPrice'])? '￥'.number_format($row['adPrice'],2, '.', ',') : '--';?></td>
						</tr>
                        <tr class="data-show-<?php echo ($key%2+1);?>"><td colspan="9" style="padding:0px 0px;" class="expandMemberSourceContent" id="expandMemberSourceContent_<?php echo $row['name'];?>"></td></tr>
<?php
}
?>
<?php else:?>
<tr><td colspan="7" align="center">没有找到相关记录！</td></tr>
<?php endif;?>

					</table>
  <input type="hidden" id="expandAdMemberSourceUrl" name="expandAdMemberSourceUrl"  value="<?php echo $this->projectUrl(array('action'=>'ad-put-On-member-source'));?>" />
                <input type="hidden" id="expandAdMemberSubSourceUrl" name="expandAdMemberSubSourceUrl"  value="<?php echo $this->projectUrl(array('action'=>'ad-put-on-member-sub-source'));?>" />
				</form>
		</div>
		</div>
	</div>
    <script>
    $(function(){
		$("#searchBtn").click(function(){
			$("#searchForm").attr("action","<?php echo $this->projectUrl(array('action'=>$this->reportType,'day'=>'between'));?>");
			$("#searchForm").submit();
		})
		$("#exportBtn").click(function(){
			$("#searchForm").attr("action","<?php echo $this->projectUrl(array('action'=>'export-ad-report','day'=>$this->key));?>");
			$("#searchForm").submit();
		})
	})
    </script>
</body>
</html>